Tragectories and Variations of Family Decision Making Across Countires

In this piece, I will demonstrate my graphing abilities.

What is Family Decision Making

As previously stated, adolescents were presented with a variety o topics that families with adolescents often have to make decisions about, and chose the answer that best reflected who made most of the decisions on each topic. The scale ranged from 1 (My parents decide this without discussing it with me) to 5 (I decide this without discussing it with my parents), with 3 representing a joint decision (My parents and I make the decision together). Adolescents were asked these questions at three timepoints, two years and three years after the initial observation.

Data Being Used

Several different variables were used for the following analyses. Alongside Family Decision Making (FDM), Age (Age), Socio-economic Status (SES), Gender (ChGender), and Country of origin (Country) were used to help identify potential trends in the data. Below are the countries utilized in this dataset.

levels(data$Country)
##  [1] "USA-Hispanic"          "China-Jinan"           "China-Shanghai"       
##  [4] "Italy-Naples"          "Italy-Rome"            "Kenya"                
##  [7] "Philippines"           "Thailand"              "Sweden"               
## [10] "USA-African American"  "USA-European American" "Colombia"             
## [13] "Jordan"                "China-Chongqing"

Plotting Family Decision Making

I can begin by making a plot of Age and Family Decision Making.

data %>%
ggplot(
  aes(x=Age_Exact, 
      y = FDM, 
      group = Country, 
      color = Country)) + 
  geom_line(stat = "summary", fun = "mean") +
  theme_bw() +
  scale_color_manual(values=c("#000000","#ff0000","#8F00FF", "#0bb4ff", "#50e991", "#e6d800", "#fb19f5", "#ffa300", "#dc0ab4", "#0000fB", "#b3d4ff", "#00bfa0", "#00ffff")) +
  labs(
    x = "Age", 
    y = "Family Decision Making", 
    color = "Country",
    title = "Age and Country Effects on Family Decision Making")

This plot is ok, but there are majors ways to improve it. There is no rhyme or reason to the colors included, and it’s hard to visualize the trend of “Family Decision Making increases as adolescents increase in age.”

My first suggestion is to smooth out the lines.

data %>%
ggplot(
  aes(x=Age_Exact, 
      y = FDM, 
      group = Country, 
      color = Country)) + 
  geom_smooth(
    size = .5,
    span = 1,
    se = FALSE) +
  theme_bw() +
  scale_color_manual(values=c("#000000","#ff0000","#8F00FF", "#0bb4ff", "#50e991", "#e6d800", "#fb19f5", "#ffa300", "#dc0ab4", "#0000fB", "#b3d4ff", "#00bfa0", "#00ffff")) +
  labs(
    x = "Age", 
    y = "Family Decision Making", 
    color = "Country",
    title = "Age and Country Effects on Family Decision Making")

This had the effect of minimizing the noise of the first graph. It is easier to see the overall positive linear trend of Family Decision Making as adolescents get older.

The next suggestion is to combine some of the data. For example, we can combine the United states ethnicities to create one USA line.

Country_Collapse <- data %>%
  mutate(Country = case_when(
    Country %in% c("USA-African American", "USA-European American", "USA-Hispanic") ~ "United States",
    Country %in% c("China-Shanghai", "China-Chongqing") ~ "China",
    Country %in% c("Italy-Naples", "Italy-Rome") ~ "Italy",
    Country == "Kenya" ~ "Kenya",
    Country == "Philippines" ~ "Philippines",
    Country == "Thailand" ~ "Thailand",
    Country == "Sweden" ~ "Sweden",
    Country == "Colombia" ~ "Colombia",
    Country == "Jordan" ~ "Jordan",
    Country == "India" ~ "India"
  ))

Now we can create a plot that just reflects countries.

Country_Collapse %>%
ggplot(
  aes(x=Age_Exact, 
      y = FDM, 
      group = Country, 
      color = Country)) + 
  geom_smooth(
    aes(group = 1),
    method = "loess",
    formula = y~x,
    se = TRUE,
    alpha = .2,
    color = "black",
    size = .5
  ) +
  geom_smooth(
    size = .5,
    span = 1,
    se = FALSE
    ) +
  theme_bw() +
  scale_color_manual(values=c("#ff0000","#8F00FF", "#0bb4ff", "#50e991", "#e6d800", "#fb19f5", "#ffa300", "#0000fB", "maroon", "#00bfa0")) +
  labs(
    x = "Age", 
    y = "Family Decision Making", 
    color = "Country",
    title = "Country Effects on Family Decision Making Over Time")

This helped clean up some of the clutter of the extra lines. I also included the average FDM line to help show the distinct differences across countries.

Country_Collapse <- Country_Collapse %>%
  mutate(Index1 = case_when(
    Index1 == "1" ~ "Time 1",
    Index1 == "2" ~ "Time 2",
    Index1 == "3" ~ "Time 3"
  ))
view(Country_Collapse)

Country_Collapse %>% ggplot(
  aes(x=Age_Exact, 
      y = FDM, 
      group = Country, 
      color = Country)) + 
  geom_smooth(
    aes(group = 1),
    method = "loess",
    formula = y~x,
    se = TRUE,
    alpha = .2,
    color = "black",
    size = .5
  ) +
  facet_wrap(~Index1, scales = "free") +
  geom_smooth(
    size = .5,
    span = 1,
    se = FALSE
    ) +
  theme_bw() +
  scale_color_manual(values=c("#ff0000","#8F00FF", "#0bb4ff", "#50e991", "#e6d800", "#fb19f5", "#ffa300", "#0000fB", "maroon", "#00bfa0")) +
  labs(
    x = "Age", 
    y = "Family Decision Making", 
    color = "Country",
    title = "Country Effects on Family Decision Making Over Time")

The benefit of this method is we can hilight the fact that this was longitudinal data. We can more easily see how the data changes across time. For comparison, the plot below has the axes locked across all plots. That can help us see changes that aren’t warped by the axes.

A final way we can look at the data is using a spaghetti plot. A spaghetti plot takes all individual observations and plots them onto the graph.

Country_Collapse %>% ggplot(
  aes(x=Age_Exact, 
      y = FDM, 
      group = ID, 
      color = Country)) + 
 geom_smooth(
    size = .5,
    span = 1,
    se = FALSE,
    show.legend = FALSE
    ) +
facet_wrap(~Country, scales = "free") +
  theme_bw() +
scale_color_manual(values=c("#ff0000","#8F00FF", "#0bb4ff", "#50e991", "#e6d800", "#fb19f5", "#ffa300", "#0000fB", "black", "#00bfa0")) +
  labs(
    x = "Age", 
    y = "Family Decision Making", 
    color = "Country",
    title = "Country Effects on Family Decision Making Over Time")+
  theme(plot.title = element_text(size = 20),
        axis.title = element_text(size = 15),
        axis.text = element_text(size = 12))

As this graph currently stands, I would only use it to demonstrate that there is a lot of variation within each country.